package org.tp8.sampleapp.jaxb.adapter;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * The Class XmlLongAdapter.
 */
public class XmlLongAdapter extends XmlAdapter<String, Long> {
	
	/* (non-Javadoc)
	 * @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
	 */
	@Override
	public String marshal(Long id) throws Exception {
		String result;
		if (id == null) {
			result = "";
		} else {
			result = id.toString();
		}
		return result;
	}

	/* (non-Javadoc)
	 * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
	 */
	@Override
	public Long unmarshal(String id) throws Exception {
		return Long.parseLong(id);
	}
}